import request from '@/utils/request'
import qs from 'qs'
const baseUrl = import.meta.env.VITE_APP_BASE_JKPG
const apiFault = {
  // 查询影响指标
  selectInfluenceIndex: function (data) {
    return request({
      url: baseUrl + '/yxgzyx/selectInfluenceIndex',
      method: 'post',
      data
    })
  },
  // 左侧卫星tree
  getEquipNodeTree: function () {
    return request({
      url: baseUrl + '/equipTree/getEquipNodeTree',
      method: 'get'
    })
  },
  // 预想故障列表
  getFailureList: function (data) {
    return request({
      url: baseUrl + `/yxgzyx/anticipatoryFailurePageList`,
      method: 'post',
      data: qs.parse(data)
    })
  },
  // 查询预想故障
  selectInfluence: function (id) {
    return request({
      url: baseUrl + `/yxgzyx/selectInfluence/${id}`,
      method: 'get'
    })
  },
  // 新增预想故障
  saveAnticipatoryFailure: function (data) {
    return request({
      url: baseUrl + `/yxgzyx/saveAnticipatoryFailure`,
      method: 'post',
      data
    })
  },
  // 编辑预想故障
  editAnticipatoryFailure: function (data) {
    return request({
      url: baseUrl + `/yxgzyx/editAnticipatoryFailure`,
      method: 'post',
      data
    })
  },
  // 删除预想故障
  deleteAnticipatoryFailure: function (id) {
    return request({
      url: baseUrl + `/yxgzyx/deleteAnticipatoryFailure/${id}`,
      method: 'delete'
    })
  },
  // 删除预想影响
  deleteInfluence: function (id) {
    return request({
      url: baseUrl + `/yxgzyx/deleteInfluence/${id}`,
      method: 'delete'
    })
  },
  // 新增预想影响
  saveInfluence: function (data) {
    return request({
      url: baseUrl + `/yxgzyx/saveInfluence`,
      method: 'post',
      data: qs.parse(data)
    })
  },
  // 编辑预想影响
  editInfluence: function (data) {
    return request({
      url: baseUrl + `/yxgzyx/editInfluence`,
      method: 'post',
      data: qs.parse(data)
    })
  },
  // 历史故障详情
  selectOneAnticipatoryDetail: function (id) {
    return request({
      url: baseUrl + `/yxgzyx/selectOneAnticipatoryDetail/${id}`,
      method: 'get'
    })
  },
  // 影响详情
  selectOneInfluenceIndexDetail: function (id) {
    return request({
      url: baseUrl + `/yxgzyx/selectOneInfluenceIndexDetail/${id}`,
      method: 'get'
    })
  },
  // 历史故障列表
  getHistoryList: function (data) {
    return request({
      url: baseUrl + `/lsgzyx/pageList`,
      method: 'post',
      data: qs.parse(data)
    })
  },
  // 删除历史故障
  deleteHistoryFault: function (id) {
    return request({
      url: baseUrl + `/lsgzyx/deleteHistoryFault/${id}`,
      method: 'delete'
    })
  },
  // 编辑历史故障
  editHistoryFault: function (data) {
    return request({
      url: baseUrl + `/lsgzyx/editHistoryFault`,
      method: 'post',
      data: qs.parse(data)
    })
  },
  // 新增历史故障
  saveHistoryFault: function (data) {
    return request({
      url: baseUrl + `/lsgzyx/saveHistoryFault`,
      method: 'post',
      data
    })
  },
  // 历史故障详情
  selectOneHistoryFaultDetail: function (id) {
    return request({
      url: baseUrl + `/lsgzyx/selectOneHistoryFaultDetail/${id}`,
      method: 'get'
    })
  },
  // 数据同步
  getDataSync: function (nodeId) {
    return request({
      url: baseUrl + `/lsgzyx/dataSynchronous?nodeId=` + nodeId,
      method: 'get'
    })
  }
}
export { apiFault }
